package com.wxzz.elearing.evaluation.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wxzz.elearing.evaluation.dto.*;
import com.wxzz.elearing.evaluation.entity.*;
import com.wxzz.elearing.evaluation.vo.BusinessCategoryTopicIsPassVo;
import com.wxzz.elearing.evaluation.vo.TopicVo;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 测评题库 服务类
 * </p>
 *
 * @author
 * @since 2021-04-10
 */
public interface ITopicService extends IService<Topic> {

    /**
     * 添加题目分类
     *
     * @param topicCategory
     * @return
     */
    ReturnVO saveTopicCategory(TopicCategory topicCategory);

    /**
     * 删除题目分类
     *
     * @param topicCategoryId
     * @return
     */
    ReturnVO deleteTopicCategory(Long topicCategoryId);

    /**
     * 题目分类层级展示
     *
     * @return
     */
    ReturnVO<List<TopicCategory>> listTopicCategoryByPid();

    /**
     * 根据当前id查询
     *
     * @param id
     * @return
     */
    ReturnVO<Long> selectPid(Long id);

    /**
     * 添加/修改题目
     *
     * @param topic
     * @return
     */
    ReturnVO saveTopic(Topic topic);

    /**
     * 根据id删除题目
     *
     * @param id
     * @return
     */
    ReturnVO deleteTopicById(Long id);

    /**
     * 删除工厂体检/星级认证/能力测评关联题目
     * @return
     */
    ReturnVO deleteBusinessCategoryTopic(Long businessCategoryTopicId);


    /**
     * 修改答案选项
     *
     * @param topicAnswer
     * @return
     */
    ReturnVO updateTopicAnswer(TopicAnswer topicAnswer);

    /**
     * 题库列表
     *
     * @param topicDto
     * @return
     */
    ReturnVO<JgPageVo<List<Topic>>> listTopic(TopicDto topicDto);

    /**
     * 查询工厂体检/星级认证/能力测评详情题库
     *
     * @param inTopicDto
     * @return
     */
    ReturnVO<JgPageVo<List<Topic>>> listInTopic(InTopicDto inTopicDto);

    /**
     * 展示工厂体检试题(小程序)
     *
     * @param type     0-工厂体检 //1-星级认证
     * @param wxUserId
     * @return
     */
    ReturnVO<TopicVo> wxListTopic(Integer type, Long wxUserId);

    /**
     * 展示能力测评项目(小程序)
     *
     * @return
     */
    ReturnVO<JgPageVo<List<BusinessCategoryEvaluation>>> listBusinessCategoryEvaluation(Long wxUserId, WxBusinessCategoryEvaluationDto wxBusinessCategoryEvaluationDto);

    /**
     * 展示能力测评试题(小程序)
     *
     * @param type                         1-星级认证 2-能力测评
     * @param businessCategoryEvaluationId
     * @return
     */
    ReturnVO<TopicVo> wxListTopic4evaluation(Long wxUserId,Integer type, Long businessCategoryEvaluationId);

    /**
     * 保存草稿箱
     *
     * @param topicMongoDto
     * @return
     */
    ReturnVO saveTopicMongoDto(TopicMongoDto topicMongoDto);

    /**
     * 查询草稿箱列表 0-工厂体检 1-星级认证 2-能力测评
     *
     * @param wxUserId
     * @return
     */
    ReturnVO<List<TopicMongoDto>> listTopicMongoDto(Long wxUserId, TopicMongoSelDto topicMongoSelDto);

    /**
     * 查询草稿箱详情
     *
     * @param uid
     * @return
     */
    ReturnVO<TopicMongoDto> selectTopicMongoDtoByUid(String uid);

    /**
     * 工厂体检/星级认证/能力测评测试结束调用
     *
     * @param businessCategoryTopicIsPassDto
     * @return
     */
    ReturnVO businessCategoryTopicIsPass(JSONObject jsonObject, BusinessCategoryTopicIsPassDto businessCategoryTopicIsPassDto);

    /**
     * 查询能力测评结果
     *
     * @return
     */
    ReturnVO<BusinessCategoryEvaluationHistory> selectBusinessCategoryEvaluationHistoryById(Long businessCategoryEvaluationHistoryId);

    /**
     * 修改测评建议
     *
     * @param updateSuggestDto
     * @return
     */
    ReturnVO updateSuggest(UpdateSuggestDto updateSuggestDto);

    /**
     * 查询工厂体检/星级认证测评结果 0-工厂体检 1-星级认证
     *
     * @param businessCategoryRuleHistoryId
     * @return
     */
    ReturnVO<BusinessCategoryRuleHistory> selectBusinessCategoryRuleHistoryById(Long businessCategoryRuleHistoryId, Integer type);

    /**
     * Excel根据分类导入题库
     * @param token
     * @param file
     */
    ReturnVO importTopic(String token,Long topicCategoryId,MultipartFile file);

    /**
     * 根据分类导出题库
     * @param response
     * @param topicCategoryId
     */
    void exportTopic(HttpServletResponse response, Long topicCategoryId);
}
